package com.qingshanhui.home_module.module1;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.qingshanhui.home_module.R;
import com.qingshanhui.home_module.utils.Banner;

/**
 * Desc:顶部Banner控件
 * <p>
 * Author: AnYaBo
 * Date: 2021/1/31
 * Copyright: Copyright (c) 2016-2022
 * Company: @小牛科技
 * Email:anyabo@xiaoniu.com
 * Update Comments:
 */
public class TopBannerViewHolder implements Banner.BannerViewHolder<Object> {

    @Override
    public View createView(Context context, int position, Object data) {
        View view = LayoutInflater.from(context).inflate(R.layout.top_banner_item,null);
        ImageView imageView = view.findViewById(R.id.top_banner_item_iv);
        TopBannerModel topBannerModel = (TopBannerModel) data;
        Glide.with(context).load(topBannerModel.logo).apply(RequestOptions.bitmapTransform(new RoundedCorners(20))).into(imageView);
        return view;
    }

}
